package HibernateOrderManagerment.bean;

import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Table(name="orders")
@Entity
public class Orders {
	
    @Id
    @Column(name="id")
	private long id;
//    @Column(name="customer_id")
//	private long customerId;
//	@Column(name="order_status_id")
//	private long orderStatusId;
	@Column(name="create_date_time")
	private String dateTime;
	
	@ManyToOne
	@JoinColumn(name="customer_id")
	private User customer;
	@ManyToOne
	@JoinColumn(name="order_status_id")
	private OrderStatus orderStatus;
	@OneToMany
	@JoinColumn(name="orders_id")
	private Set<OrderItem> orderItems;
	@OneToMany
	@JoinColumn(name="orders_id")
	private Set<Send> sends;
	@OneToMany
	@JoinColumn(name="orders_id")
	private Set<Pay> pays;
	@OneToMany
	@JoinColumn(name="orders_id")
	private Set<Reception> receptions;
	
	public Orders(){
		id=-1;
	}


	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}
     

	
	public String getdateTime() {
		return dateTime;
	}


	public void setdateTime(String dateTime) {
		this.dateTime = dateTime;
	}





	public User getCustomer() {
		return customer;
	}


	public void setCustomer(User customer) {
		this.customer = customer;
	}


	public OrderStatus getOrderStatus() {
		return orderStatus;
	}


	public void setOrderStatus(OrderStatus orderStatus) {
		this.orderStatus = orderStatus;
	}
    

	public Set<OrderItem> getOrderItems() {
		return orderItems;
	}


	public void setOrderItems(Set<OrderItem> orderItems) {
		this.orderItems = orderItems;
	}


	public Set<Send> getSends() {
		return sends;
	}


	public void setSends(Set<Send> sends) {
		this.sends = sends;
	}


	public Set<Pay> getPays() {
		return pays;
	}


	public void setPays(Set<Pay> pays) {
		this.pays = pays;
	}


	public Set<Reception> getReceptions() {
		return receptions;
	}


	public void setReceptions(Set<Reception> receptions) {
		this.receptions = receptions;
	}


	@Override
	public String toString() {
		return "Orders [id=" + id + ", dateTime=" + dateTime + ", customerId=" + customer.getId() + ", orderStatusId=" + orderStatus.getId()
				+ "]";
	}


//	@Override
//	public String toString() {
//		return "Orders [id=" + id + ", Datetime=" + Datetime + "]";
//	}
    


	

}
